package com.itheima.demo.callable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Test02 {//线程优先级设置
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        //设置参数
        MyCallable mc = new MyCallable();
        FutureTask<String> ft1 = new FutureTask<>(mc);
        FutureTask<String> ft2 = new FutureTask<>(mc);
        //创建线程
        Thread t1 = new Thread(ft1);
        Thread t2 = new Thread(ft2);
        //设置线程名字
        t1.setName("大乔");
        t2.setName("小乔");
        //设置优先级,优先级范围1-10,默认5
        t1.setPriority(5);
        t2.setPriority(5);
        //开启线程
        t1.start();
        t2.start();
    }
}
